/*
游戏类

*/

Vue.component('game',{
	data(){
		return {
			msg: 'abc',
			show1: false,
			wfPaiDs: [], 
			dfPaiDs: [],
			
		}
	},
	created(){
		console.log('game created');
		startGame();
		this.one();
		this.initData();
		
	},
	mounted(){
		bus.$on('aabbcc',function(msg){
			console.log('aabbcc-=>',msg);
		});
	},
	methods:{
		one(){
			console.log("one");
		},
		initData(){
			console.log("initData");
			
			
			
		}
	},
	template: '#game'
});

Vue.component('JiFenQu',{
	data(){
		return {
			msg:'abc'
		}
	},
	template: '#JiFenQu'
});


Vue.component('ShouPaiQu',{
	data(){
		return {
			msg:'abc'
		}
	},
	template: '#ShouPaiQu'
});


Vue.component('JiPaiQu',{
	data(){
		return {
			msg:'abc'
		}
	},
	template: '#JiPaiQu'
});


Vue.component('PaiDuiQu',{
	data(){
		return {
			msg:'abc'
		}
	},
	template: '#PaiDuiQu'
});


Vue.component('XiuXiQu',{
	data(){
		return {
			msg:'abc'
		}
	},
	template: '#XiuXiQu'
});

Vue.component('CardButton',{
	data(){
		return {
			msg:'abc',
			show1:false,
			shouPais:[
				{id:1,name:'盖亚'},
				{id:2,name:'杰克'},
				{id:3,name:'赛文'},
				{id:4,name:'迪迦'},
			],
			shouPais2:[],
		}
	},
	created(){
		console.log("create()");
		//console.log("wfszPais-=>"+JSON.stringify(wfszPais));
		for(let tmp1 of wfszPais){
			console.log("tmp1-=>",tmp1);
			var tmp2 = {
				"id":tmp1.id,
				"name":tmp1.名称
			}
			this.shouPais2.push(tmp2);
		}
	},
	methods:{
		click1(e){
			console.log('e-=>',e);
			//this.$dialog({ message: '提示' });
			//Dialog({ message: '提示' });
			/*
			this.$dialog.alert({
				title:'abc',
				message:'ddd',
			}).then(()=>{
				console.log("ccc");
			});
			*/
			this.show1=true; 
			bus.$emit('aabbcc','22222222');
		}
	},
	template: '#CardButton'
});

(function(){
	console.log("load game.js");
	
	//console.log("a1-=>",a1);
	//ct1.toString1();
	
})()

function startGame(){
	console.log("startGame");
	
	//console.log("wfPais-=>"+JSON.stringify(wfPais));//wfszPais
	//console.log("dfPais-=>"+JSON.stringify(dfPais));//dfszPais
	
	for(var i1=0;i1<4;i1++){
		var tmp1 = wfPais.pop();
		wfszPais.push(tmp1);
	}
	for(var i2=0;i2<4;i2++){
		var tmp2 = dfPais.pop();
		dfszPais.push(tmp1);
	}
	
	//console.log("wfszPais-=>"+JSON.stringify(wfszPais));
	//console.log("dfszPais-=>"+JSON.stringify(dfszPais));
	
	console.log("wfPais-=>"+wfPais.length+",dfPais-=>"+dfPais.length);
}